<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<HTML>
<HEAD>
<meta name="GENERATOR" content="Microsoft&reg; HTML Help Workshop 4.1">
<Title>SOAP Headers</Title><link rel="STYLESHEET" type="text/css" href="styles.css">
</HEAD>
<BODY>
<h1>SOAP Headers</h1>

PocketSOAP supports both send and receiving SOAP Header, these work in exactly 
the same way as elements within the Body, except that they are accessed
through the <b>Headers</b> property on the Envelope rather than the Parameters property.
In addition, you can set the various header attributes including <b>actor</b>, 
<b>mustUnderstand</b> through the normal Node object.

<h2>Sample</h2>

This sample sets a simple header containing authentication information.
<pre class="sample">
dim e, h
set e = CreateObject("pocketSOAP.Envelope.2")
e.SetMethod "DoStuff", "http://soap.example.org/"

set h = e.Headers.Create ("Authentication", empty, "http://soap.example.org/authentication/2001/01/")
h.Nodes.Create "Username", "user@example.org"
h.Nodes.Create "MD5", "9b3e64e326537b4e8c0ff19e953f9673"

wscript.echo e.serialize
</pre>
This generates the following SOAP message
<pre class="sample">
&lt;S:Envelope
        S:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'
        xmlns:S='http://schemas.xmlsoap.org/soap/envelope/'
        xmlns:E='http://schemas.xmlsoap.org/soap/encoding/'
        xmlns:a='http://soap.example.org/authentication/2001/01/'
        xmlns:b='http://www.w3.org/2001/XMLSchema-instance'
        xmlns:c='http://www.w3.org/2001/XMLSchema'
        xmlns:d='http://soap.example.org/'&gt;
&lt;S:Header&gt;
&lt;a:Authentication&gt;
&lt;Username b:type='c:string'&gt;user@example.org&lt;/Username&gt;
&lt;MD5 b:type='c:string'&gt;9b3e64e326537b4e8c0ff19e953f9673&lt;/MD5&gt;
&lt;/a:Authentication&gt;
&lt;/S:Header&gt;
&lt;S:Body&gt;&lt;d:DoStuff&gt;&lt;/d:DoStuff&gt;
&lt;/S:Body&gt;&lt;/S:Envelope&gt;
</pre>

You can set the actor and mustUnderstand attributes through the 
actor and mustUnderstand properties on the node, e.g.
<pre class="sample">
dim e, h
set e = CreateObject("pocketSOAP.Envelope.2")
e.SetMethod "DoStuff", "http://soap.example.org/"

set h = e.Headers.Create ("Authentication", empty, "http://soap.example.org/authentication/2001/01/")
h.mustUnderstand = true 
h.actor = "http://soap.example/org/authentication/"
h.Nodes.Create "Username", "user@example.org"
h.Nodes.Create "MD5", "9b3e64e326537b4e8c0ff19e953f9673"

wscript.echo e.serialize
</pre>
This generates the following SOAP message
<pre class="sample">
&lt;S:Envelope
        S:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'
        xmlns:S='http://schemas.xmlsoap.org/soap/envelope/'
        xmlns:E='http://schemas.xmlsoap.org/soap/encoding/'
        xmlns:a='http://soap.example.org/authentication/2001/01/'
        xmlns:b='http://www.w3.org/2001/XMLSchema-instance'
        xmlns:c='http://www.w3.org/2001/XMLSchema'
        xmlns:d='http://soap.example.org/'&gt;
&lt;S:Header&gt;
&lt;a:Authentication S:mustUnderstand='1' S:actor='http://soap.example/org/authentication/'&gt;
&lt;Username b:type='c:string'&gt;user@example.org&lt;/Username&gt;
&lt;MD5 b:type='c:string'&gt;9b3e64e326537b4e8c0ff19e953f9673&lt;/MD5&gt;
&lt;/a:Authentication&gt;
&lt;/S:Header&gt;
&lt;S:Body&gt;&lt;d:DoStuff&gt;&lt;/d:DoStuff&gt;
&lt;/S:Body&gt;&lt;/S:Envelope&gt;
</pre>
All the standard serialization process applies to headers, so you can 
write custom serializer for handling header parts.


<BR><BR><BR>
<h3>Copyright</h3>
<p>Copyright &copy; Simon Fell, 2000-2004. All rights reserved.<br>

</BODY>
</HTML>
